package com.sh.data.engine.domain.shims.sql.ddl;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;
import java.util.Map;

/**
 * @author: mengzheng.mhc
 * @date: 2024/6/5 15:20
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class CreateTableParam {

    private String schema;

    private String tableName;

    private String dbName;

    private String tableComment;

    private List<FieldInfo> fieldInfoList;

    /**
     * 针对hive的分区字段
     */
    private List<FieldInfo> partitionFieldList;

    /**
     * 针对hive的存储类型
     */
    @Builder.Default
    private String storeType = "TEXTFILE";

    /**
     * 针对hive，是否是外表
     */
    @Builder.Default
    private boolean isExternal = false;

    /**
     * 表的额外属性
     */
    private Map<String, String> tblProperties;

    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    public static class FieldInfo {

        private String fieldName;

        private String fieldType;

        private boolean nullable;

        private String defaultVal;

        private String comment;

        private boolean primaryKey;

        private boolean autoIncrement;
    }
}
